// 云函数入口文件
const cloud = require('wx-server-sdk')
const fs = require('fs')
const path = require('path')
cloud.init({
  env: 'cloud1-8gy1tclq6b5571fd'
})

export async function main(event, context) {
  //new Buffer 可用 Buffer.from替代
  try{
    return await uploadFile({
      cloudPath: event.path,
      fileContent: Buffer.from(event.file, 'base64')
    })
  }catch(e){
    return e;
  }
}